package net.esj.basic.core.engine.template;

import java.io.StringWriter;

public class TemplateUtils {

	public static String processTemplate(AbstractTemplate template,
			Object model) throws Exception {
		StringWriter result = new StringWriter();
		template.process(model, result);
		return result.toString();
	}
	
	public static String processTemplate(AbstractTemplateEngine engine,String templatePath,Object model) throws Exception{
		AbstractTemplate template  = engine.getTemplate(templatePath);
		return processTemplate(template, model);
	}
}
